package com.yanqu.road.logic.sort;

import com.yanqu.road.entity.tradewar.UserTradeWarInfo;

import java.util.Comparator;

public class TradeWarScoreSort implements Comparator<UserTradeWarInfo> {
    @Override
    public int compare(UserTradeWarInfo o1, UserTradeWarInfo o2) {
        long result = o2.getScore() - o1.getScore();
        if (result != 0) {
            return (int) result;
        }
        long time = o1.getModifyTime() - o2.getModifyTime();
        result = time > 0 ? 1 : (time == 0 ? 0 : -1);
        return (int) result;
    }
}
